<template>
	<view class="content">
		<!-- 电量显示栏-->
		<view class="top_nav">
			<view class="kong"></view>
			<view class="tab_item">
				<view class="return" @click="returnPage">
					<image src="https://jialianxin-1301053941.cos.ap-chengdu.myqcloud.com/static/course/jiantou.png"></image>
				</view>
				<view class="title">资讯详情</view>
				<view class="return"></view>
			</view>
		</view>
		
		<!-- 资讯详情 -->
		<view class="zixun_wrap">
			<view class="zixun_title">{{zixun.title}}</view>
			<view class="zixun_con">
				<rich-text class="zixun_detail" :nodes="zixun.content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				zixun_id:'',
				zixun:{},
				token:''
			}
		},
		onLoad(options) {
			this.zixun_id = options.id;
			this.token=options.token
			this.get_zixunDetail();
		},
		methods: {
			// 返回上一页
			returnPage(){
				uni.navigateBack({
					delta:1
				})
			},
			//资讯详情
			get_zixunDetail(){
				var url = '/api/home/index/archivesDetails';
				let params = {
					id:this.zixun_id,
					token:this.token
				};
				this.Unfold_data.upload_data(params, 'GET', url, res => {
					// console.log(res)
					if (res.statusCode == 200 && res.data.code == 1) {
						this.zixun = res.data.data;
						//图片处理
						var richtext = this.zixun.content;
						const regex = new RegExp('<img', 'gi');
						richtext = richtext.replace(regex, `<img style="width: 100%;"`);
						this.zixun.content = richtext;
					}
				});
			}
		}
	}
</script>

<style lang="scss">
.content {
	width: 100%;
	position: relative;
	.top_nav{
		width: 100%;
		height: 160upx;
		background-image: url('https://jialianxin-1301053941.cos.ap-chengdu.myqcloud.com/static/buy/1.png');
		background-size: cover;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 10;
		.kong{
			width: 100%;
			height: 60upx;
		}
		.tab_item{
			width: 90%;
			margin: 0 auto;
			height: 100upx;
			display: flex;
			align-items: center;
			justify-content: center;
			.return{
				flex: 1;
				width: 100%;
				image{
					width: 29upx;
					height: 29upx;
				}
			}
			.title{
				flex: 8;
				width: 100%;
				color: #ffffff;
				display: flex;
				align-items: center;
				justify-content: center;
				z-index: 10;
				display: -webkit-box;
				overflow: hidden;
				-webkit-box-orient:vertical;
				-webkit-line-clamp:1;
			}
		}
	}
	.zixun_wrap{
		width: 100%;
		padding-top: 160upx;
		.zixun_title{
			width: 100%;
			padding: 0 30upx;
			height: 100upx;
			display: flex;
			align-items: center;
			font-size: 32upx;
			font-weight: bold;
		}
		.zixun_con{
			width: 95%;
			margin: 0 auto;
			.zixun_detail{
				width: 100%;
				margin: 0 auto;
			}
		}
	}
}
</style>
